package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.HouseholdService;
import com.ruoyi.system.api.domain.Household;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteHouseholdFallbackFactory implements FallbackFactory<HouseholdService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteHouseholdFallbackFactory.class);

    @Override
    public HouseholdService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new HouseholdService()
        {

            @Override
            public List<Household> getHousehold(String name) {
                return null;
            }

            @Override
            public Household getHouseholdName(String householdName) {
                return null;
            }

            @Override
            public Household getUser(Long id) {
                return null;
            }
        };
    }
}
